package com.simple.datax.flow.service;

import com.simple.datax.flow.dao.ibatis.model.FlowActivityInstance;
import com.simple.datax.flow.message.BaseEcMessage;

/** 
 * @Title: FlowActivityInstanceService.java 
 * @Package com.simple.datax.flow.service 
 * @Description: TODO(添加描述) 
 * @author tonney 
 * @date 2012-12-31 上午11:10:54 
 * @version V1.0 
 */
public interface TaskActivityManager {

	/**
	 * 保存流程活动记录
	 */
	public void saveFlowActivityInstance(FlowActivityInstance flowActivityInstance);
	
	/**
	 * 更新活动状态至缓存
	 * @param flowActivityInstance
	 */
	public void updateActivityStateToCache(FlowActivityInstance flowActivityInstance);
	
	/**
	 * 根据流程ID和活动ID构造流程活动实例
	 * @param flowid
	 * @param activity
	 * @return
	 */
	public FlowActivityInstance getFlowActivityInstance(String flowid,String activity);
	
//	/**
//	 * 根据流程id获取已处理的活动
//	 * @param flowid
//	 * @return
//	 */
//	public List<FlowActivityInstance> getFlowActivityInstanceByTaskid(String taskid);

	/**
	 * 校验活动
	 * @param activityNo
	 * @return 1-活动合法,2-活动不合法
	 */
	public int validateActivity(String senderId,String taskid,String activityNo,FlowActivityInstance activityInstance);
	

	/**
	 * 根据流程号和活动号生成新的报文(涉及修改报文头的发送者地址，接收者地址和后续活动号)
	 * @param taskid
	 * @param activityNo
	 * @param validateReslut
	 * @return
	 */
	public int editMessageByFlowidAndActivityNo(String flowid,String activityNo,BaseEcMessage ecMessage,FlowActivityInstance activityInstance);
	
	/**
	 * 恢复任务对应的活动状态至缓存
	 * @param taskid
	 * @return
	 */
	public boolean recoverActivityCache(String taskid);
}
